import { handleActions } from "redux-actions"
import { signup, signup_fail, signup_reset, signup_success } from "../actions/signup"


const initState = {
  loading: false,
  loaded: false,
  success: false,
  meaage: ''

}
const signupReducer = handleActions({
  [signup]: () => ({
    loading: true,
    loaded: false,
    success: false,
    meaage: ''
  }),
  [signup_success]: () => ({
    loading: false,
    loaded: true,
    success: true,
    meaage: ''
  }),
  [signup_fail]: (state, action) => ({
    loading: false,
    loaded: true,
    success: false,
    meaage: action.payload.message
  }),
  [signup_reset]: () => ({
    loading: false,
    loaded: false,
    success: false,
    meaage: ''
  })
},initState)



export default signupReducer
